-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow lazily chunking unsorted iteration #55
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, other than possibly making the skip tests a little broader
src/lib.rs
Outdated
|
||
// Check that the skip_lazy feature produces the expected results. | ||
let mut unsorted_reader_skip = UnsortedShardReader::<T1>::open(tmp.path()); | ||
let to_skip = (disk_chunk_size * 3) + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe scramble this value somehow to get different boundaries, or try a few different carefully chosen skip values here? You could skip to a file boundary, a chunk boundary, or the middle of a chunk and ideally the tests would hit all 3 cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ultimately didn't merge the cellranger patch that made use of this feature, so I'm a bit on the fence about merging it at all at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking into this again now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I enhanced the tests by writing two shard files of size n_items, to test the set reading logic. I expanded the skip tests to include these offsets:
check_unsorted_skip(0)?;
check_unsorted_skip(1)?;
check_unsorted_skip(disk_chunk_size)?;
check_unsorted_skip((disk_chunk_size * 3) + 1)?;
check_unsorted_skip(n_items)?; // skip entire first file
check_unsorted_skip(n_items + 1)?; // skip entire first file plus next item
check_unsorted_skip(n_items * 2)?; // skip everything
Refactors unsorted shard iteration into a few more granular types.
Adds a
skip_lazy
method to the top-level type to allow lazily seeking into a collection of shard files. This allows chunking a set of shard files for parallel unordered iteration by multiple readers without having to read anything more than the shard index plus the first partially-read shard.